import { createHashRouter, Navigate } from 'react-router-dom'
import type { RouteObject } from 'react-router-dom'

import NewsList from '../views/router-base/NewsList'
import FoodList from '../views/router-base/FoodList'
import NewsDetail from '../views/router-base/NewsDetail'
import FoodDetail from '../views/router-base/FoodDetail'
import NotFound from '../views/router-base/NotFound'

const routes: RouteObject[] = [
  {
    path: '/newslist',
    element: <NewsList />
  },
  {
    path: '/foodslist',
    element: <FoodList />
  },
  {
    path: '/',
    element: <Navigate to='/foodslist' />
  },
  {
    path: '/newsdetail',
    element: <NewsDetail />
  },
  {
    path: '/fooddetail/:id/:name',
    element: <FoodDetail />
  },
  {
    path: '*',
    element: <NotFound />
  }
]

const router = createHashRouter(routes)

export default router
